package com.crape.dict.dao.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.crape.common.ibatis.SqlMapClientDaoSupportEx;
import com.crape.common.model.DictCity;
import com.crape.common.model.DictDistrict;
import com.crape.common.model.DictProvince;
import com.crape.dict.dao.IAreaDAO;

@SuppressWarnings("unchecked")
@Service
public class AreaDAOImpl extends SqlMapClientDaoSupportEx implements IAreaDAO {

    @Override
    public List<DictProvince> findAllProvinces() {
        return (List<DictProvince>) this.queryList("findAllProvinces", null);
    }

    @Override
    public List<DictCity> findCitysByProvinceId(Long provinceId) {
        if (provinceId == null) {
            return null;
        }
        return (List<DictCity>) this.queryList("findCitysByProvinceId", provinceId);
    }

    @Override
    public List<DictDistrict> findDistrictsByCityId(Long cityId) {
        if (cityId == null) {
            return null;
        }
        return (List<DictDistrict>) this.queryList("findDistrictsByCityId", cityId);
    }

}
